﻿
namespace Patterns4Net.Tests.PatternEnforcer.Core
{
    /// <summary>
    /// Mocking of <see cref="Func{T,TResult}"/> is common task in the tests.
    /// </summary>
    public class FuncMock<T, TResult>
    {
        private readonly TResult result;

        public FuncMock(TResult result)
        {
            this.result = result;
            this.Called = false;
        }

        public bool Called { get; set; }

        public T Argument { get; set; }

        public TResult Func(T arg)
        {
            this.Called = true;
            this.Argument = arg;
            return this.result;
        }
    }
}